//
//  KXHomeCell.swift
//  KXBook
//
//  Created by  on 2022/9/8.
//

import UIKit

class KXHomeCell: UITableViewCell {
    @IBOutlet var img: UIImageView!
    @IBOutlet var name: UILabel!
    @IBOutlet var date: UILabel!
    @IBOutlet var type: UILabel!
    @IBOutlet var money: UILabel!
    @IBOutlet var pay: UILabel!
    @IBOutlet var bgVeiw: UIView!
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    var model=KXRecord(){
        didSet{
            self.img.image = UIImage(named:model.type.isPay == 1 ? "组 86" : "组 87")
            self.money.text = model.money
            self.name.text = model.descrip
            self.date.text = NSDate.transToDate("yyyy-MM-dd hh:mm", Int(model.stamp))
            self.type.text = LS(model.type.name)
            self.pay.text = model.type.isPay == 1 ? LS("支出") : LS("收入")
            self.bgVeiw.borderHexColor = model.type.isPay == 1 ? "#E27BC1" : "#A280C1"
            self.type.textHexColor = self.bgVeiw.borderHexColor
            self.type.borderHexColor = self.bgVeiw.borderHexColor
        }
    }
}
